from fastapi import FastAPI
import asyncio
import random
import uvicorn

app = FastAPI()

@app.get("/get-report")
async def get_report(number: int | None = 0):
    if number == 0:
        number = get_random_number(1, 5)
    # number = get_random_number(1, 10)
    print(f"number: {number}")
    await asyncio.sleep(number)
    return {"number": number}


# 获取随机数的方法
def get_random_number(start: int, end: int):
    return random.randint(start, end)

if __name__ == "__main__":
    num = get_random_number(1, 100)
